perm filename DV.CH[MF,ALS]4 blob sn#782023 filedate 1985-01-25 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00007 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	@x Tell WEAVE to print only the changes:
C00003 00003	@x
C00005 00004	@x Opening packed binary files:
C00007 00005	@x Set up terminal I/O:
C00009 00006	@x The default font directory:
C00011 00007	@x Change to file name conventions:
C00015 ENDMK
C⊗;
@x Tell WEAVE to print only the changes:
	\centerline{\hsize 5in\baselineskip9pt
		\vbox{\ninerm\noindent
		The preparation of this report
		was supported in part by the National Science
		Foundation under grants IST-8201926 and MCS-8300984,
		and by the System Development Foundation. `\TeX' is a
		trademark of the American Mathematical Society.}}}
@y
\centerline{(This listing shows the changes for {\sc WAITS} only)}}
\let\maybe=\iffalse
@z
@x
@d print(#)==write(#)
@d print_ln(#)==write_ln(#)
@y
@d print(#)==write(tty,#)
@d print_ln(#)==write_ln(tty,#)
@z

@x Specify compiler directives:
@p program DVI_IMP(@!dvi_file,@!im_file@!output);
@y
@p @t\4@>@{$D+,W+@} {no debugging overhead}
program DVI_IMP(@!dvi_file,@!im_file);
@z
@x Opening packed binary files:
@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
begin reset(dvi_file);
cur_loc←0;
end;
@#
procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file,cur_name);
cur_gf_loc←0;
end;
@y
@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
begin reset(dvi_file,'','/B:8');
cur_loc←0;
end;
@#
procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file,cur_name,'/B:8/O/N:9');
cur_gf_loc←0;
end;
@z

@x
@p procedure open_im_file; {prepares to write packed bytes in |im_file|}
begin rewrite(im_file); im_byte_no←0;
end;
@y
@p procedure open_im_file; {prepares to write packed bytes in |im_file|}
begin rewrite(im_file,'','/B:8'); im_byte_no←0;
end;
@z


@x Set up terminal I/O:
and |term_out| for terminal output.
@↑system dependencies@>

@<Glob...@>=
@!buffer:array[0..terminal_line_length] of ASCII_code;
@!term_in:text_file; {the terminal, considered as an input file}
@!term_out:text_file; {the terminal, considered as an output file}
@y
and |term_out| for terminal output.
@↑system dependencies@>

@d term_in==tty
@d term_out==tty

@<Glob...@>=
@!buffer:array[0..terminal_line_length] of ASCII_code;
@z
@x The default font directory:
@d default_directory_name=='TeXfonts:' {change this to the correct name}
@d default_directory_name_length=9 {change this to the correct length}
@y
@d default_directory_name=='[MF,ALS]' {change this to the correct name}
@d default_directory_name_length=8 {change this to the correct length}
@z
@x Change to file name conventions:
@ The string |cur_name| is supposed to be set to the external name of the
\.{GF} file for the current font. This usually means that we need to
prepend the name of the default directory, and
to append the suffix `\.{.GF}'. Furthermore, we change lower case letters
to upper case, since |cur_name| is a \PASCAL\ string.
@↑system dependencies@>

@<Move font name into the |cur_name| string@>=
for k←1 to name_length do cur_name[k]←' ';
if p=0 then
	begin for k←1 to default_directory_name_length do
		cur_name[k]←default_directory[k];
	r←default_directory_name_length;
	end
else r←0;
for k←font_name[nf] to font_name[nf+1]-1 do
	begin incr(r);
	if r+4>name_length then
		abort('DVIIMP capacity exceeded (max font name length=',
			name_length:1,')!');
@.DVIIMP capacity exceeded...@>
	if (names[k]≥"a")∧(names[k]≤"z") then
			cur_name[r]←xchr[names[k]-@'40]
	else cur_name[r]←xchr[names[k]];
	end;
cur_name[r+1]←'.'; cur_name[r+2]←'G'; cur_name[r+3]←'F'; {|cur_name[r+4]←'M';|}
@y
@ The string |cur_name| is supposed to be set to the external name of the
\.{GF} file for the current font. This usually means that we need to
prepend the name of the default directory, and
to append the suffix `\.{.GF}'. But at {\mc SAIL} we append the
directory name after the font name. And we compress `\.{oldenglish}' to
`\.{oldish}'.
@↑system dependencies@>

@<Move font name into the |cur_name| string@>=
for k←1 to name_length do cur_name[k]←' ';
r←0;
for k←font_name[nf]+p to font_name[nf+1]-1 do
    if (k≤font_name[nf]+p+2)∨(k≥font_name[nf+1]-3) then
	begin incr(r);
	if r+4>name_length then
		abort('DVItype capacity exceeded (max font name length=',
			name_length:1,')!');
@.DVItype capacity exceeded...@>
	if (names[k]≥"a")∧(names[k]≤"z") then
			cur_name[r]←xchr[names[k]-@'40]
	else cur_name[r]←xchr[names[k]];
	end;
cur_name[r+1]←'.'; cur_name[r+2]←'G'; cur_name[r+3]←'F'; {|cur_name[r+4]←'M';|}
r←r+3;
if p=0 then for k←1 to default_directory_name_length do
	begin incr(r);
	if r>name_length then abort('Font name is too long!');
	cur_name[r]←default_directory[k];
	end
else for k←font_name[nf] to font_name[nf]+p-1 do
	begin incr(r);
	if r>name_length then abort('Font name is too long!');
	if (names[k]≥"a")∧(names[k]≤"z") then
			cur_name[r]←xchr[names[k]-@'40]
	else cur_name[r]←xchr[names[k]];
	end
@z